{% extends 'AdminPanelDashboardBundle::layout.html.twig' %}


{% block stylesheets %}
  {{ parent() }}
{% endblock %}

{% block javascripts %}
{{ parent() }}
<!-- jQuery Validate -->
<script src="/adminTemplate/theme/scripts/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
<script src="/adminTemplate/theme/scripts/form_validator.js" type="text/javascript"></script>
<script src="/ckeditor/ckeditor.js"></script>
<script>
function changeTitle(defaultObject){
  
  var tmpTitle = $(defaultObject).val();
  $("#slug").val('content/'+tmpTitle);
  
}
</script>

{% endblock %}

{% block content %}

<div id="content">
  <ul class="breadcrumb">
    <li><a href="index.php" class="glyphicons home"><i></i> AdminPlus</a></li>
    <li class="divider"></li>
    <li>Forms</li>
    <li class="divider"></li>
    <li>Form Validator</li>
  </ul>
  <div class="separator"></div>

  <h3 class="glyphicons show_thumbnails_with_lines"><i></i> Шинээр контент нэмэх</h3>
  <div class="separator"></div>

  <form class="form-horizontal" style="margin-bottom: 0;" id="contentEditForm" action="{{ path('content_create') }}" method="post" {{ form_enctype(form) }} autocomplete="off">

    <div class="well" style="padding-bottom: 20px; margin: 0;">
      <h4>{{entity.contentTitle}}</h4>
      <hr class="separator" />
      <div class="row-fluid">
        <div class="span6" style="width: 90%">          
          <div class="control-group">                
              {{ form_label(form.content_title, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
              <div class="controls">{{ form_widget(form.content_title, { 'id':'content_title', 'attr': {'class': 'span12', 'onChange':'changeTitle(this)'} }) }}</div>
            </div>

            <div class="control-group">  
              <div class="widget-body" style="padding: 10px 0 0;">              
              {{ form_label(form.content_body, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
                  <div class="controls">{{ form_widget(form.content_body, { 'id' : 'editor1', 'attr': {'class': 'ckeditor span12', 'rows' : '5'} }) }}</div>              
                </div>
              </div>

              <div class="control-group">                
              {{ form_label(form.category, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
                  <div class="controls">{{ form_widget(form.category, {'id' : 'contentCategory', 'attr': {'class': 'span12'} }) }}</div>
                </div>

                <div class="control-group">                
             {{ form_label(form.menu, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
                    <div class="controls">{{ form_widget(form.menu, { 'attr': {'class': 'span12'} }) }}</div>
                  </div>

                  <div class="control-group">                
            {{ form_label(form.slug, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
                      <div class="controls">{{ form_widget(form.slug, {'id' : 'slug', 'attr': {'class': 'span12', 'readonly':'readonly'} }) }}</div>
                    </div>

                    <div class="control-group">                
              {{ form_label(form.img_thumb, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
                        <div class="controls">{{ form_widget(form.img_thumb, { 'attr': {'class': 'span12'} }) }}</div>
                      </div>

                      <div class="control-group">                
            {{ form_label(form.img_large, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
                          <div class="controls">{{ form_widget(form.img_large, { 'attr': {'class': 'span12'} }) }}</div>
                        </div>

                        <div class="control-group">                
              {{ form_label(form.is_special, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
                            <div class="controls">{{ form_widget(form.is_special, { 'attr': {'class': 'span12'} }) }}</div>
                          </div>

                          <div class="control-group">                
              {{ form_label(form.is_active, label|default(null), { 'label_attr': { 'class': 'control-label' } }) }}
                              <div class="controls">{{ form_widget(form.is_active, { 'attr': {'class': 'span12'} }) }}</div>
                            </div>
                <hr class="separator" />

                <div class="form-actions">
                  <button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Хадгалах</button>
                  <a href="{{ path('content') }}"><button type="button" class="btn btn-icon btn-default glyphicons circle_remove"><i></i>Буцах</button></a>
                </div>
                </div>
              {{ form_widget(form._token) }}
              </form>
                <!-- End Content -->
              </div>

{% endblock %}